<template>
    <div class="child-component">
        <childComponent>
            <template #user>
                <div>这是具名插槽</div>
            </template>
        </childComponent>
    </div>
</template>

<script setup lang="jsx">
import { useSlots } from 'vue';

const childComponent = () => {
    const slots = useSlots();
    return (
        <>
            <div>这是子组件</div>
            <div>{slots.user ? slots.user() : '具名插槽'}</div>
        </>
    )
}
</script>